{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}

{% block title %}Demo小站主页{% endblock %}
{% block page_content %}
    <div class="page-header">
        <h1>您好,{% if current_user.is_authenticated %} {{current_user.username}} {% else %} 游客 {% endif %}</h1>
    </div>

    <div>
        {% if current_user.can(Permission.WRITE_ARTICLES) %}
            {{ wtf.quick_form(form) }}
        {% endif %}
    </div>
    <br/>
    <div class = "post-tabs">
        <div class="nav nav-tabs">
            <li {% if not show_followed %} class="active" {% endif %}><a href="{{ url_for('main.showall') }}">全部</a></li>
            {% if current_user.is_authenticated %}
                <li {% if show_followed %} class ="active" {% endif %}><a href="{{ url_for('main.showfollowed') }}">关注</a> </li>
            {% endif %}
        </div>
        {% include "_post.html" %}
    </div>

    {% if pagination %}
    <div class="pagination">
        {{ macros.pagination_widget(pagination, 'main.index') }}
    </div>
    {% endif %}
{% endblock %}

{% block scripts %}
{{ super() }}
<script src="/static/Markdown.Converter.min.js"></script>
<script src="/static/Markdown.Sanitizer.min.js"></script>
{% endblock %}